package main

import (
	"fmt"
	"math"
)

type Number struct {
	x, y, z float64
}

func main() {
	num := Number{2.0, 4.0, 6.0}
	numChannel := make(chan Number)
	defer close(numChannel)
	go sendNum(numChannel, num)
	num = <-numChannel
	go PowNum(numChannel, num)
	num = <-numChannel
	go showNum(num)
	fmt.Println(num)
}

func sendNum(numChannel chan Number, num Number) {
	numChannel <- num
}

func PowNum(numChannel chan Number, num Number) {
	x := math.Pow(num.x, 2.0)
	y := math.Pow(num.y, 2.0)
	z := math.Pow(num.z, 2.0)
	num = Number{x, y, z}
	numChannel <- num
}

func showNum(num Number) {
	fmt.Println(num)
}
